import axios from 'axios'
import type {} from 'axios'

const req = axios.create({
  baseURL: '/api',
  timeout: 20000,
})

req.interceptors.request.use((config) => {
  return config
})

req.interceptors.response.use((res) => {
  if (res.data.response) return res.data.response
  return res.data
})

export default req
